package com.breezelin.freshmarket.entities.data;

/**
 * Created by Breeze Lin
 * 11:07 2016/5/15
 * 1linyufeng1@gmail.com
 */

import com.breezelin.freshmarket.entities.JsonStruct;

import org.json.JSONObject;

/**
 * 折扣
 */
public class Discount implements JsonStruct {

	/*
	{
        "SaleFlag": "8",
        "SaleText": "购买分类下商品，满 138 元 减 20 元",
        "LinkType": "0",
        "LinkCode": "",
        "LinkUrl": "",
        "RuleId": "60f062c7-ff45-4956-b5aa-dd33b8b6579a"
      }
	*/

	/**
	 * 折扣类型
	 */
	private String saleFlag;
	/**
	 * 折扣文本
	 */
	private String saleText;
	/**
	 * 链接类型
	 */
	private String linkType;
	/**
	 * 链接代码
	 */
	private String linkCode;
	/**
	 * 链接地址
	 */
	private String linkUrl;
	/**
	 * 链接规则
	 */
	private String ruleId;

	public Discount() {
	}

	public String getSaleFlag() {
		return saleFlag;
	}

	public String getSaleText() {
		return saleText;
	}

	public String getLinkType() {
		return linkType;
	}

	public String getLinkCode() {
		return linkCode;
	}

	public String getLinkUrl() {
		return linkUrl;
	}

	public String getRuleId() {
		return ruleId;
	}

	public Discount(JSONObject jsonObject) {
		fromJson(jsonObject);
	}

	@Override
	public void fromJson(JSONObject jsonObject) {
		saleFlag = jsonObject.optString("SaleFlag");
		saleText = jsonObject.optString("SaleText");
		linkType = jsonObject.optString("LinkType");
		linkCode = jsonObject.optString("LinkCode");
		linkUrl = jsonObject.optString("LinkUrl");
		ruleId = jsonObject.optString("RuleId");
	}

	@Override
	public JSONObject toJson() {
		return new JSONObject();
	}
}

